package com.czy.owner.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.czy.owner.R;
import com.czy.owner.entity.FindActivityModel;
import com.czy.owner.utils.glide.GlideUtils;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;

/**
 * Created by Raven on 2017/12/13.
 */

public class HorizontalActivityAdapter extends RecyclerArrayAdapter<FindActivityModel> {

    private Context context;

    public HorizontalActivityAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new BusinessViewHolder(parent);
    }

    class BusinessViewHolder extends BaseViewHolder<FindActivityModel> {

        private ImageView itemImageView;

        public BusinessViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_horizontal_activity_layout);
            itemImageView = $(R.id.item_image_view);
        }

        @Override
        public void setData(FindActivityModel data) {
            super.setData(data);
            //添加数据
            GlideUtils.loadImage(context, data.getShowToFindLogo(), itemImageView, new GlideUtils.ImageLoadListener<String, GlideDrawable>() {
                @Override
                public void onLoadingComplete(String uri, ImageView view, GlideDrawable resource) {

                }
                @Override
                public void onLoadingError(String source, Exception e) {

                }
            }, R.mipmap.default_banner, R.mipmap.default_banner);
        }
    }
}
